package com.dmgn.serviceimpl;

import java.util.List;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.dmgn.bean.Label;
import com.dmgn.dao.LabelMapper;
import com.dmgn.service.ILabelService;



public class LabelServiceImpl implements ILabelService{
	private ApplicationContext context;
	
	LabelMapper labelMapper;
	public LabelServiceImpl(){
		context=new ClassPathXmlApplicationContext("applicationContext.xml");
		labelMapper = (LabelMapper)context.getBean("LabelMapper");	
	}

	@Override
	public boolean addLabel(Label label) {
		if(labelMapper.insertSelective(label) == 1)
			return true;
		else
			return false;
	}

	public List<Label> findLabel(int type) {
		return labelMapper.selectLabel(type);
	}
	
}
